package model

import (
	"gorm.io/gorm"
	"time"
)

type Ticket struct {
	Id               uint           `gorm:"column:id;type:bigint UNSIGNED;primaryKey;not null;" json:"id"`
	TicketName       string         `gorm:"column:ticket_name;type:varchar(50);comment:票名;not null;" json:"ticket_name"`          // 票名
	RemainingTickets uint           `gorm:"column:remaining_tickets;type:bigint;comment:余票;not null;" json:"remaining_tickets"`   // 余票
	VoteType         uint           `gorm:"column:vote_type;type:tinyint(1);comment:1候补 2有坐 3无座;not null;" json:"vote_type"`      // 1候补 2有坐 3无座
	Price            float64        `gorm:"column:price;type:decimal(10, 2);comment:价格;not null;" json:"price"`                   // 价格
	Seat             string         `gorm:"column:seat;type:varchar(255);comment:座位;not null;" json:"seat"`                       // 座位
	SeatType         uint           `gorm:"column:seat_type;type:tinyint(1);comment:1硬座 2软座 3硬卧 4软卧;not null;" json:"seat_type"`  // 1硬座 2软座 3硬卧 4软卧
	TicketType       uint           `gorm:"column:ticket_type;type:tinyint(1);comment:1机票 2车票 3火车票;not null;" json:"ticket_type"` // 1机票 2车票 3火车票
	CreatedAt        time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdateAt         time.Time      `gorm:"column:update_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"update_at"`
	DeleteAt         gorm.DeletedAt `gorm:"column:delete_at;type:datetime(3);default:NULL;" json:"delete_at"`
}

func (t *Ticket) TableName() string {
	return "ticket"
}
